package com.online_video.dao.impl;

import com.online_video.dao.BaseDao;
import com.online_video.dao.HistoryDao;
import com.online_video.entity.History;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 黄金星
 * @Date: 2022/03/24/下午8:35
 * @Description:
 */
public class HistoryDaoImpl extends BaseDao implements HistoryDao {
    @Override
    public List<History> queryByU_id(Integer u_id) {
        String sql ="SELECT * FROM `T_history` WHERE `u_id` = ?";
        return super.queryForList(History.class,sql,u_id);
    }

    @Override
    public int deleteAll() {
        return 0;
    }

    @Override
    public int insert(History history) {
        String sql = "INSERT INTO `T_history` (`vid`,`u_id`,`playTime`,`date`) VALUES (?,?,?,?)";
        return super.update(sql,history.getVid(),history.getU_id(),history.getPlayTime(),history.getDate());
    }
}
